package com.ruoyi.project.easyexcel;

import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.style.column.AbstractHeadColumnWidthStyleStrategy;

/**
 * @Author huyunqiang
 * @Description 自定义列宽
 * @Date 2023/6/30 17:00
 **/
public class ColumnWidthStyleStrategy extends AbstractHeadColumnWidthStyleStrategy {

    @Override
    protected Integer columnWidth(Head head, Integer columnIndex) {
        switch (columnIndex) {
            case 6:
                return 20;
            case 7:
                return 20;
            case 9:
                return 15;
            case 10:
                return 30;
        }
        return 40;
    }
}
